package club.emergency.wechat.resource_study.search.consumer.service.fallback_factory;

import club.emergency.wechat.common.response.ResponseEntity;
import club.emergency.wechat.common.response.StatusCode;
import club.emergency.wechat.resource_study.search.consumer.service.ResourceStudySearchConsumer;
import feign.hystrix.FallbackFactory;
import org.springframework.stereotype.Component;

/**
 * Create with IntelliJ IDEA
 * Project Name: wechat
 * Package Name: club.emergency.wechat.resource_study.search.consumer.service.fallback_factory
 * Date: 2019/3/25
 *
 * @author: 快乐的小菌菌
 * Description:
 */
@Component
public class ResourceStudySearchFallbackFactory implements FallbackFactory<ResourceStudySearchConsumer> {
    @Override
    public ResourceStudySearchConsumer create(Throwable throwable) {
        return (resourceCategory, pageNo, pageSize) -> ResponseEntity.error(StatusCode.DB_SEARCH_ERROR, "查询资料学习数据失败！", throwable.getMessage());
    }
}
